package com.store.practice.controller;

import com.store.practice.common.api.CommonResult;
import com.store.practice.service.HomePageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

@Api(tags = "HomePageController",description = "首页管理")
@RequestMapping("/storeHome")
@RestController
public class HomePageController {
    @Autowired
    private HomePageService homePageService;

    @ApiOperation("展示首页信息")
    @GetMapping("/getInfo")
    public CommonResult getInfo(Integer storeId, @RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date){
        Map result = homePageService.getInfo(storeId, date);
        return CommonResult.success(result);
    }
}
